package com.zzw.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zzw.dao.OilWorkerDao;
import com.zzw.pojo.OilWorker;
import com.zzw.service.OilWorkerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class OilWorkerServiceImpl implements OilWorkerService {
    @Autowired
    private OilWorkerDao oilWorkerDao;
    @Override
    public PageInfo findPage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<OilWorker> list = oilWorkerDao.findByPage(pageNum,pageSize);
        PageInfo<OilWorker> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<OilWorker> findAll() {
        return oilWorkerDao.findAll();
    }

    @Override
    public void addOilWorker(OilWorker oilWorker) {
        oilWorkerDao.addOilWorker(oilWorker);
    }
}
